<?php
	include('secure_db.php');
	session_start();
	if(!isset($_SESSION['clientonline'])){
		header('Location: accueil.php');
	}	
	
	
	if(isset($_GET['name']))	{
			include("connection_mysqli.php");
			
			$req=$connexion->prepare('UPDATE client SET favoritestore= ? WHERE login= ?');
			$req->bind_param("ss",$val1,$val2);
			if($_SESSION['favoritestore']==""){
				$val1=Secure::db($_GET['name']);
			}else{
				$val1=$_SESSION['favoritestore'].'/'.Secure::db($_GET['name']);
			}
			$val2=$_SESSION['login'];
			
			$_SESSION['favoritestore']=$val1;
			$result=$req->execute();
			
			header('Location: client-myfavoritestore.php');
	}
	else{
		header('Location: accueil.php');
	}
							
?>

